<template>
  <div class="home">
      <titletop :titlename="titlename"></titletop>
      <search class="search"></search>
      <div class="content">
        <mt-loadmore  class="paddingtop2"   :bottom-all-loaded="allLoaded" bottomPullText="上拉加载" ref="loadmore" >
          <swipe class="swipehome" :loadimg="loadimg" :searchresult="searchresult" :autotime="5000" :iscontinue="true"></swipe>
          <nav1></nav1>
          <nav2></nav2>
          <div class="div_line"></div>
          <productlist></productlist>
        </mt-loadmore>
      </div>
  </div> 
</template>

<script>
import Mock from 'mockjs'
import titletop from 'components/title'
import search from 'components/search'
import swipe from 'components/swipe'
import nav1 from 'components/nav1'
import nav2 from 'components/nav2'
import productlist from 'components/productlist'

export default {
  name: 'home',
  props : [],
  data () {
    return {
      titlename:'药品服务',
      allLoaded:false,
      searchvalue:'',
      searchresult:[]  //轮播
    }
  },
  components: {
      titletop,
      search,
      swipe,
      nav1,
      nav2,
      productlist
  },
  methods : {
      loadimg(){
        return '';
      },
      getswipelist(){
          let data = Mock.mock({
              // 属性 list 的值是一个数组，其中含有 5 个元素
              'list|5': [{
                  // 属性 id 是一个自增数，起始值为 1，每次增 1
                  'id|+1': 1,
                  'imgUrl' : '../../static/img/home_lunbo_1.png'
              }]
          });
          this.searchresult = data.list;
      }
      /*loadTop() {
        let _this = this;
        console.log("下拉在执行");
        setTimeout(() => {
            _this.$refs.loadmore.onTopLoaded();
        }, 1000);
      },
      loadBottom() {
        console.log("上拉在执行");
        let _this = this;
        setTimeout(() => {
            _this.getprolist();
            _this.prolistresult = _this.totalprolist;
            _this.$refs.loadmore.onBottomLoaded();
        }, 1000);
      }*/
  },
  mounted(){
      console.log('home');
      this.getswipelist();
  }
}

</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
    .home{
      .search{
        top:40px;
      }
      .content{
        height: 100%;
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
      }
      .div_line{
        width:100%;box-sizing: border-box; line-height: 0;  height: 0.156rem; background-color: rgb(238, 238, 238); position: relative; background-position: initial initial; background-repeat: initial initial;
      }
    }
    
</style>
